package com.dreamer.domain.user.enums;

public enum AgentLevelEnum {

    VIP(9,"vip"),DAQU(8,"大区"),ZONGDAI(7,"总代"),DONGSHI(6,"董事"),
    LIANCHUANG(5,"联创"),JINGLIHEHUOREN(4,"经理合伙人"),ZONGJIANHEHUOREN(3,"总监合伙人"),ZONGCAIHEHUOREN(2,"总裁合伙人"),
    FENGONGSIHEHUOREN(1,"分公司合伙人"),FENGONGSI(0,"分公司"),YOUKE(10,"游客");



    private int state;

    private String stateInfo;

    AgentLevelEnum(int state,String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public static AgentLevelEnum stateOf(int index){
        for(AgentLevelEnum statEnum : values()){
            if(statEnum.getState()==index){
                return statEnum;
            }
        }
        return null;
    }

    //获取等级
    public int getLevel(String name){
        AgentLevelEnum[] agentLevel = AgentLevelEnum.values();
        for (AgentLevelEnum agentLevelEnum : agentLevel) {
            if(agentLevelEnum.getStateInfo().equals(name)){
                return agentLevelEnum.getState();
            }
        }
        return -1;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }
}